package vn.mta.nht.mock.common.utils;

/**
 * author:TruongNH.(nguyenhuutruong.20111991@gmail.com) created date: Dec 21,
 * 2014 version: 1.0
 */
public class StringUtils {

	public static String convertArr2String(String[] arr, String replacement) {

		StringBuilder strBuilder = new StringBuilder();
		if (arr != null) {
			for (String i : arr) {
				strBuilder.append(i + " ");
			}
			return strBuilder.toString().trim().replaceAll(" ", replacement);
		} else
			return "";
	}

	public static String[] convertString2Array(String inputStr, String regex) {

		if (!inputStr.equals(null)) {
			return inputStr.split(regex);
		} else
			return new String[] {};
	}
}
